/*
package com.allwees.bs.task.order.auto;

import com.allwees.bs.core.model.order.config.ScheduleTimeProperties;
import com.allwees.bs.module.oms.dao.OrderDao;
import com.allwees.bs.module.oms.dao.OrderFlowDao;
import com.allwees.bs.module.oms.entity.Order;
import com.allwees.bs.module.oms.util.OrderUtil;
import com.allwees.core.common.util.DateUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Date;
import java.util.List;

@Slf4j
@Service

public class OrderUnShippedAutoCancelTask{

    @Autowired
    private ScheduleTimeProperties scheduleTimeProperties;

    @Autowired
    private OrderDao orderDao;

    @Autowired
    private OrderFlowDao orderFlowDao;

    @XxlJob(value="orderUnShippedAutoCancelTask")
    public ReturnT<String> run(String s) {
        doTask();
        return ReturnT.SUCCESS;
    }

    private void doTask() {
        if (scheduleTimeProperties.getOrderUnShippedAutoCancelSecond() == null) {
            return;
        }

        Date shippedExpiredAt = DateUtil.addSeconds(new Date(), -scheduleTimeProperties.getOrderUnShippedAutoCancelSecond());

        List<Order> unShippedOrders = this.orderDao.findOutOvertimeShippingOrders(shippedExpiredAt);
        if (CollectionUtils.isEmpty(unShippedOrders)) {
            return;
        }

        unShippedOrders.forEach(order->{
//            order.signal(EOrderItemAction.SYSTEM_CLOSE_BY_SHIPPING_OVER_TIME);

            Order update = new Order();
            update.setState(order.getState());
            update.setLatestAction(order.getLatestAction());
            update.setBackState(order.getBackState());
            update.setClosedAt(DateUtil.now());

            orderDao.updateByUuid(update, order.getUuid());

            orderFlowDao.insert(OrderUtil.flowOrder(order));
        });

        unShippedOrders.forEach(order -> {
//            this.paymentService.refund(order.getUuid(), order.getPaymentUuid());
        });
    }

    private void toCancelOrder(Order order) {
        // 记录订单的状态和最后的动作

    }
}
*/
